<?php
namespace app\admin\controller;

use app\BaseController;
use app\common\facade\admin\EditroomAdmin;
use app\common\facade\admin\PlayEditroomAdmin;
use think\exception\ValidateException;

class PlayEditroom extends BaseController
{
    public function pgmplaydatelist()
    {
        $param = $this->request->get([
            'channel_id'
        ]);

        try {
            $data = PlayEditroomAdmin::pgmplaydatelist($param);
        } catch (\Exception $e)
        {
            return exceptionJson($e->getMessage(), $e->getCode());
        }
            
        return successJson($data);
    }

    public function pgmplaydateadd()
    {
        $param = $this->request->post([
            'channel_id',
            'pl_date'
        ]);        

        try {
            $data = PlayEditroomAdmin::pgmplaydateadd($param);
        } catch (\Exception $e)
        {
            return exceptionJson($e->getMessage(), $e->getCode());
        }
            
        return successJson($data);
    }

    // 播出串联单频道分组获取
    public function playchannelpgm()
    {
        $param = $this->request->get([
            'day'
        ]);

        try {
            $data = PlayEditroomAdmin::playchannelpgm($param);
        } catch (\Exception $e)
        {
            return exceptionJson($e->getMessage(), $e->getCode());
        }
            
        return successJson($data);
    }

    public function playchannelpgmDel()
    {
        $ids = $this->request->delete();

        try {
            $data = PlayEditroomAdmin::playchannelpgmDel($ids);
        } catch (\Exception $e)
        {
            return exceptionJson($e->getMessage(), $e->getCode());
        }

        return successJson($data);
    }

    public function playchanneldetail()
    {
        $param = $this->request->get([
            'type'
        ]);

        try {
            $data = PlayEditroomAdmin::playchanneldetail($param);
        } catch (\Exception $e)
        {
            return exceptionJson($e->getMessage(), $e->getCode());
        }
            
        return successJson($data);
    }

    public function pgmplaystate()
    {
        $param = $this->request->get([
            'channel_id',
            'pl_date'
        ]);

        try {
            $data = PlayEditroomAdmin::pgmplaystate($param);
        } catch (\Exception $e)
        {
            return exceptionJson($e->getMessage(), $e->getCode());
        }
            
        return successJson($data);
    }

    public function pgmdetailAddEdit()
    {
        $params = $this->request->post();
        try {
            $data = PlayEditroomAdmin::pgmdetailAddEdit($params);
        } catch (\Exception $e)
        {
            return exceptionJson($e->getMessage(), $e->getCode());
        }
            
        return successJson($data);
    }

    public function pgmdetailDel()
    {
        $ids = $this->request->delete();

        try {
            $data = PlayEditroomAdmin::pgmdetailDel($ids);
        } catch (\Exception $e)
        {
            return exceptionJson($e->getMessage(), $e->getCode());
        }

        return successJson($data);
    }

}